﻿<%@ Control Language="C#" AutoEventWireup="true" CodeBehind="Script.ascx.cs" Inherits="MLM.Home.Common.Script" %>
<script src="/AdminCP/Libs/Scripts/jquery-1.9.1.min.js" type="text/javascript"></script>
<script src="/js/hideshow.js" type="text/javascript"></script>
<script src="/js/jquery.tablesorter.min.js" type="text/javascript"></script>
<script type="text/javascript" src="/js/jquery.equalHeight.js"></script>
<script src="/AdminCP/Libs/Plugins/notify/notify.js" type="text/javascript"></script>
<script type="text/javascript">
    $(function () {
        $('.CartOut').click(function () {

            var ProducID = $(this).attr('productid');
            console.log(ProducID);
            var CountProduct = $(this).prev().val();
            var CountryID = $(".HfCountryID").val();
            var UserID = $(".HfUserID").val();
            $.ajax({
                type: "POST",
                url: "/AdminCP/Pages/ShoppingCart.aspx/AddToCart",
                contentType: "application/json; charset=utf-8",
                dataType: "json",
                beforeSend: function () {
                    $('.loadingstate').css("display", "inline-block");
                    $('.loadingstate').html('<img src="/App_Themes/UIT/UITImages/vi-VN/loading7.gif" width="100" height="100" />');
                },
                data: "{'product':'" + ProducID + "','CountProduct':'" + CountProduct + "','CountryID':'" + CountryID + "','UserID':'" + UserID + "'}",
                async: true,
                success: function (msj) {
                    if (msj.d > 0) {
                        $('.loadingstate').css("display", "none");
                        $.notify.success('Add to cart success ! ', {
                            occupySpace: true,
                            close: true,
                            autoClose: 3000
                        });
                        $("#Total").text(msj.d);
                    }
                }
            });
            return false;
        });
    });
</script>
